#include <QCoreApplication>
#include <QDebug>

#include <core/riscv.h>
#include <test/instr_test.h>

#define RISCV_RAM_BASE      0x20000000      //
#define RISCV_FLASH_BASE    0x00000000      // 缺省FLASH起始
#define RISCV_RAM_SIZE     (16*1024*1024)   //
#define RISCV_FLASH_SIZE   (16*1024*1024)   // 缺省Flash大小

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    riscv_t * riscv = riscv_create();
    //
    mem_t * ram_mem = mem_create("ram", RISCV_RAM_BASE, RISCV_FLASH_SIZE, RISCV_MEM_ATTR_READABLE | RISCV_MEM_ATTR_WRITABLE);
    riscv_add_device(riscv,(st_device *) ram_mem);
    //
    mem_t * flash_mem = mem_create("flash", RISCV_FLASH_BASE, RISCV_FLASH_SIZE, RISCV_MEM_ATTR_READABLE);
    riscv_add_device(riscv,(st_device *) flash_mem);
    riscv_set_flash(riscv,flash_mem);
    instr_test(riscv);
    //
    return a.exec();
}
